package org.misterhou.spring.boot.demo;

import org.misterhou.spring.boot.demo.websocket.WebSocketClient;
import org.misterhou.spring.boot.demo.websocket.WebSocketServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class Startup {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Startup.class, args);
        // 解决 websocket 多实例不能注入 bean 问题
        WebSocketServer.setWebSocketClient(applicationContext.getBean(WebSocketClient.class));
    }
}
